﻿using AutoMapper;
using EFEntity;
using ISerives;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Serives
{
    public class config_file_third_kindServices : Iconfig_file_third_kindServices
    {
        private readonly MyDbContext myDbContext;
        private readonly IMapper mapper;

        public config_file_third_kindServices(MyDbContext myDbContext, IMapper mapper)
        {
            this.myDbContext = myDbContext;
            this.mapper = mapper;
        }
        public async Task<List<config_file_third_kind>> Select()
        {
            List<config_file_third_kind> list1 = new List<config_file_third_kind>();
            await Task.Run(() =>
            {
                List<Econfig_file_third_kind> list = myDbContext.config_file_third_kind.ToList();
                list1 = mapper.Map<List<config_file_third_kind>>(list);

            });
            return list1;
        }

        public async Task<List<Econfig_file_third_kind>> Selecter(string id)
        {
            List<Econfig_file_third_kind> list = new List<Econfig_file_third_kind>();
            await Task.Run(() =>
            {
                list = myDbContext.config_file_third_kind.Where(e => e.second_kind_id == id).ToList();
            });
            return list;

        }

        public async Task<List<Econfig_file_third_kind>> Selectsan(string id)
        {
            List<Econfig_file_third_kind> list = new List<Econfig_file_third_kind>();
            await Task.Run(() =>
            {
                list = myDbContext.config_file_third_kind.Where(e => e.second_kind_id== id).ToList();
            });
            return list;
        }
    }
}
